package com.wuyan.locationdog.adapter

import android.widget.TextView
import androidx.annotation.LayoutRes
import com.amap.api.services.core.PoiItem
import com.blankj.utilcode.util.ColorUtils

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.wuyan.locationdog.R


class MarkPoiSearchListAdapter(@LayoutRes layoutResId: Int, data: MutableList<PoiItem>?) :
    BaseQuickAdapter<PoiItem, BaseViewHolder>(layoutResId, data) {


    override fun convert(holder: BaseViewHolder, item: PoiItem) {
        holder.apply {
            getView<TextView>(R.id.tvTitle).text = item.title
            getView<TextView>(R.id.tvSubTitle).text = item.provinceName + item.cityName + item.adName + item.snippet
            getView<TextView>(R.id.btnSure).apply {


                if (holder.layoutPosition == 0) {
                    holder.itemView.setBackgroundColor(ColorUtils.getColor(com.arcsoft.commonbase.R.color.text_color_selected_10))
                    setTextColor(ColorUtils.getColor(com.arcsoft.commonbase.R.color.text_color_selected))
                    setBackgroundResource(com.arcsoft.commonbase.R.drawable.rect_blue_stroke_radius16)
                } else {
                    holder.itemView.setBackgroundColor(ColorUtils.getColor(com.arcsoft.commonbase.R.color.white))
                    setTextColor(ColorUtils.getColor(com.arcsoft.commonbase.R.color.color_6))
                    setBackgroundResource(com.arcsoft.commonbase.R.drawable.rect_solid_white_stroke_radius16)

                }
            }
        }
    }
}


